use spring_axum::{Interceptor, AxumRequest, AxumResponse, AxumBody};

#[derive(Clone, Default)]
#[spring_axum_macros::interceptor]
pub struct LogInterceptor;

impl Interceptor for LogInterceptor {
    fn on_request(&self, req: AxumRequest<AxumBody>) -> AxumRequest<AxumBody> {
        tracing::info!("--> {} {}", req.method(), req.uri());
        req
    }
    fn on_response(&self, res: AxumResponse<AxumBody>) -> AxumResponse<AxumBody> {
        tracing::info!("<-- {}", res.status());
        res
    }
}